/*
 * @(#) OrderType.java 2013-7-24 下午3:58:05
 *
 * Copyright 2013 Rockwell Automation, Inc. All rights reserved.
 * Rockwell Automation PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */package com.osi.mes.pm.util;

import java.util.HashMap;
import java.util.Vector;

 /**
  * 工单类型
  * @author Nemo, 2013-7-24 下午3:58:08
  */
public class OrderTypeUtil
{
	static HashMap<String, String> orderTypeMap = new HashMap<String, String>();
	static HashMap<String, String> orderTypeKeyMap = new HashMap<String, String>();
	
	static Vector<String> standardOrderTypes = new Vector<String>();
	static Vector<String> unStandardOrderTypes = new Vector<String>();
	static
	{
		//标准生产工单
		standardOrderTypes.add("标准生产工单");
		standardOrderTypes.add("实验生产工单");
		
		//非标准生产工单
		unStandardOrderTypes.add("生产返工－复检或返工");
		unStandardOrderTypes.add("生产返工－换包装");
		unStandardOrderTypes.add("原材料挑拣修整");
		unStandardOrderTypes.add("原料代码转换");
		unStandardOrderTypes.add("产品代码转换");
		unStandardOrderTypes.add("委托加工");
		unStandardOrderTypes.add("其他特殊生产订单");
		unStandardOrderTypes.add("原料拆分生产订单");
		
		//key -- value
		orderTypeMap.put("101", "标准生产工单");
		orderTypeMap.put("201", "生产返工－复检或返工");
		orderTypeMap.put("202", "生产返工－换包装");
		orderTypeMap.put("203", "原材料挑拣修整");
		orderTypeMap.put("301", "实验生产工单");
		orderTypeMap.put("401", "原料代码转换");
		orderTypeMap.put("402", "产品代码转换");
		orderTypeMap.put("403", "委托加工");
		orderTypeMap.put("404", "其他特殊生产订单");
		orderTypeMap.put("901", "原料拆分生产订单");
		
		//value -- key
		orderTypeKeyMap.put("标准生产工单","101");
		orderTypeKeyMap.put("生产返工－复检或返工","201");
		orderTypeKeyMap.put("生产返工－换包装","202");
		orderTypeKeyMap.put("原材料挑拣修整","203");
		orderTypeKeyMap.put("实验生产工单","301");
		orderTypeKeyMap.put("原料代码转换","401");
		orderTypeKeyMap.put("产品代码转换","402");
		orderTypeKeyMap.put("委托加工","403");
		orderTypeKeyMap.put("其他特殊生产订单","404");
		orderTypeKeyMap.put("原料拆分生产订单","901");
	}
	
	/**
	 * 获得所有的Key
	 */
	public static Object[] getAllKeys()
	{
		return orderTypeMap.keySet().toArray();
	}
	
	/**
	 * 获得所有的工单类型
	 */
	public static Object[] getAllOrderType(boolean isStandard)
	{
		return isStandard?standardOrderTypes.toArray():unStandardOrderTypes.toArray();
	}
	
	/**
	 * 获得所有的工单类型
	 */
	public static Object[] getAllOrderType()
	{
		return orderTypeMap.values().toArray();
	}
	
	/**
	 * 获得工单类型代码
	 */
	public static String getOrderTypeKey(String orderTypeName)
	{
		return orderTypeKeyMap.get(orderTypeName);
	}
	
	/**
	 * 获得工单类型名称
	 */
	public static String getOrderTypeName(String orderTypeKey)
	{
		return orderTypeMap.get(orderTypeKey);
	}
}
